<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .root{
            width: 200px;
            height: 200px;
            background: #000000;
        }
    </style>
</head>
<body>
<script>
    //创建元素
    let root = document.createElement('div')
    root.id = 'root'
    root.className = 'root'
    root.innerHTML = '测试添加节点'
    root.style.color = '#FFFFFF'
    root.style.lineHeight = '200px'
    //将新元素添加到文档树中
    document.body.appendChild(root)
    console.log(root.parentNode)


</script>
</body>
</html>